package com.some;

import java.util.*;

public class SiKe01 {

    public static char[] peopleAB(int[] nums, int m) {
        char[] chars = new char[nums.length];
        Arrays.fill(chars, 'C');
        Set<Integer> set = new HashSet<>();
        List<Integer> list = new ArrayList<>();
        List<Integer> listTmp = new ArrayList<>();
        for (int num : nums) {
            set.add(num);
            list.add(num);
            listTmp.add(num);
        }
        list.sort(Comparator.comparingInt(o -> o));
        char ab = 'A';
        int start = list.size() - 1;
        while (!isFillChars(chars)) {
            if (start >= 0 && set.contains(list.get(start))) {
                set.remove(list.get(start));
                changeAB(chars, m, listTmp.indexOf(list.get(start)), ab, set, listTmp);
                if (ab == 'A') {
                    ab = 'B';
                } else {
                    ab = 'A';
                }
            }
            start--;
        }
        return chars;
    }

    public static boolean isFillChars(char[] chars) {
        for (char aChar : chars) {
            if (aChar == 'C') {
                return false;
            }
        }
        return true;
    }

    public static void changeAB(char[] chars, int m, int index, char ab, Set<Integer> set, List<Integer> list) {
        chars[index] = ab;
        for (int i = 1; i <= m; i++) {
            if (index + i < chars.length && chars[index + i] == 'C') {
                chars[index + i] = ab;
                set.remove(list.get(index + i));
            } else if (index + i < chars.length && chars[index + i] != 'C') {
                int k = i + 1;
                while (index + k < chars.length && chars[index + k] != 'C') {
                    k++;
                }
                if (index + k < chars.length && chars[index + k] == 'C') {
                    chars[index + k] = ab;
                    set.remove(list.get(index + k));
                }
            }
            if (index - i >= 0 && chars[index - i] == 'C') {
                chars[index - i] = ab;
                set.remove(list.get(index - i));
            } else if (index - i >= 0 && chars[index - i] != 'C') {
                int k = i + 1;
                while (index - k >= 0 && chars[index - k] != 'C') {
                    k++;
                }
                if (index - k >= 0 && chars[index - k] == 'C') {
                    chars[index - k] = ab;
                    set.remove(list.get(index - k));
                }
            }
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }

        for (char c : peopleAB(nums, m)) {
            System.out.print(c);
        }
    }
}
